package com.yimin.controller;


import com.yimin.entity.ComSEntity;
import com.yimin.jpa.ComProjectSServerApi;
import com.yimin.jpa.ComServerApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("com")
public class ComApiController {


    @Resource
    ComServerApi comServerApi;


    @Resource
    ComProjectSServerApi comProjectSServerApi;

    @GetMapping("getAll")
    List<ComSEntity> getAll(){

        List<ComSEntity> re=comServerApi.findAll();

        re.forEach(item->{


            item.setProjectSEntityList(comProjectSServerApi.findAllByComId(item.getId()));
        });

        return re;




    }


}
